using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

using SLIITPro.Core;
using SLIITPro.Data.Entity;

namespace SLIITPro.Data
{
    public class Search
    {
        private Datamanager _datamanager;
        public List<BusinessItem> GetSearchResults(string searchString, string businessType, string location)
        {
            _datamanager = new Datamanager();
            var query = string.Format(SLIITPro.Data.Properties.Resources.querySearch, searchString, businessType, location);
            var table = _datamanager.ExecuteQuery(query, "BusinessItem", null);
            var businessItems = (from DataRow row in table.Rows
                                 select new BusinessItem(row)).ToList();
            return businessItems;
        }
    }

}